import {http} from "http.js"

function getBannerList(){
  return http({
    url:"api/public/banners"
  })
}


//首页获取岗位列表
function getJobList(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:`/api${hasPublic}/recruit/list`,
    data:{
      interviewDates: requestData ? requestData.interviewDates:[],
      jobType: requestData ? requestData.jobType:1,
      lat: requestData ? requestData.lat:null,
      lng: requestData ? requestData.lng:null,
      limit: requestData ? requestData.limit:20,
      offset: requestData ? requestData.offset:0,
      settlementTypes: requestData ? requestData.settlementTypes:[],
      shiftType: requestData ? requestData.shiftType:null,
      welfareIds: requestData ? requestData.welfareIds:[],
      workType: requestData ?requestData.workType:null,
    },
    method:"POST"
  })
}

//搜索获取岗位列表
function searchJobList(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:`/api${hasPublic}/recruit/list`,
    data:{
      interviewDates: requestData ? requestData.interviewDates:[],
      jobType: requestData ? requestData.jobType:1,
      lat: requestData ? requestData.lat:null,
      lng: requestData ? requestData.lng:null,
      limit: requestData ? requestData.limit:20,
      offset: requestData ? requestData.offset:0,
      settlementTypes: requestData ? requestData.settlementTypes:[],
      shiftType: requestData ? requestData.shiftType:null,
      welfareIds: requestData ? requestData.welfareIds:[],
      workType: requestData ?requestData.workType:null,
      title:requestData?requestData.title:null
    },
    method:"POST"
  })
}

//搜索获取门店列表
function getStoreList(requestData){
  let hasPublic = getApp().globalData.token?``:`/public`
  return http({
    url:`/api${hasPublic}/recruit/list_by_store_name`,
    data:{
      lat: requestData ? requestData.lat:null,
      lng: requestData ? requestData.lng:null,
      limit: 20,
      offset: 0,
      title:requestData?requestData.title:null
    },
    method:"POST"
  })
}

//获取福利
function getWelfare(){
  return http({
    url:"/api/public/welfares_for_recruit"
  })
}

module.exports={
  getBannerList:getBannerList,
  getJobList:getJobList,
  getWelfare:getWelfare,
  searchJobList:searchJobList,
  getStoreList:getStoreList
}